// 引入了工厂函数
import { createApp } from 'vue'
import App from './App.vue'
// elementUI
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/es/locale/lang/zh-cn';  // 导入中文语言包
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 路由
import router from './router'
// store
import store from './store'

// 引入滚动条
import PerfectScrollbar from 'vue3-perfect-scrollbar'
import 'vue3-perfect-scrollbar/dist/vue3-perfect-scrollbar.css'
//引入 Markdown 编辑、预览组件
//引入 Markdown 编辑、预览组件
import VueMarkdownEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';

import Prism from 'prismjs';

VueMarkdownEditor.use(vuepressTheme, {
    Prism,
});

import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/preview.css';
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
import '@kangc/v-md-editor/lib/theme/style/github.css';

// 引入高亮
import hljs from 'highlight.js';
VMdPreview.use(vuepressTheme, {
  Hljs: hljs,
});


import createKatexPlugin from '@kangc/v-md-editor/lib/plugins/katex/cdn';

VueMarkdownEditor.use(createKatexPlugin);

VMdPreview.use(createKatexPlugin)
const app = createApp(App)
app.use(ElementPlus, { locale }); // 设置中文语言包
app.use(ElementPlus)
app.use(router)
app.use(VueMarkdownEditor);
app.use(VMdPreview);
app.use(PerfectScrollbar)
app.use(store)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.mount('#app')
//挂载消息提示
import { ElMessage } from 'element-plus'

app.config.globalProperties.$message = ElMessage;
